<?php

require_once 'Zend/Gdata/Extension.php';

// class Rats_Extension_JobReport extends Zend_Gdata_Extension
// {
//   protected $_rootNamespace = 'raws';
//   protected $_rootElement = 'report';
// 
//   public function __construct() 
//   {
//       foreach (Raws::$namespaces as $nsPrefix => $nsUri) {
//           $this->registerNamespace($nsPrefix, $nsUri);
//       }
//       parent::__construct();
//   }
//   
//   public function getDOM($doc = null)
//   {
//       $element = parent::getDOM($doc);
//       // if ($this->_report !== null) {
//       //     $element->appendChild($this->_report->getDOM($element->ownerDocument));
//       // }
//       return $element;
//   }
//   
//   protected function takeChildFromDOM($child)
//   {
//       $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
//   
//       switch ($absoluteNodeName) {
//         // case $this->lookupNamespace('raws') . ':' . 'report':
//         //     $report = new Rats_Extension_JobReport();
//         //     $report->transferFromDOM($child);
//         //     $this->_report = $report;
//         //     break;
//         default:
//             parent::takeChildFromDOM($child);
//             break;
//       }
//   }
//   
// }

class Rats_Extension_JobReports extends Zend_Gdata_Extension
{

    protected $_rootNamespace = 'raws';
    protected $_rootElement = 'reports';

    // protected $_report = null;

    public function __construct() 
    {
        foreach (Raws::$namespaces as $nsPrefix => $nsUri) {
            $this->registerNamespace($nsPrefix, $nsUri);
        }
        parent::__construct();
    }
    
    public function getDOM($doc = null)
    {
        $element = parent::getDOM($doc);
        // if ($this->_report !== null) {
        //     $element->appendChild($this->_report->getDOM($element->ownerDocument));
        // }
        return $element;
    }
    
    protected function takeChildFromDOM($child)
    {
        $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
    
        switch ($absoluteNodeName) {
          // case $this->lookupNamespace('raws') . ':' . 'report':
          //     $report = new Rats_Extension_JobReport();
          //     $report->transferFromDOM($child);
          //     $this->_report = $report;
          //     break;
          default:
              parent::takeChildFromDOM($child);
              break;
        }
    }
    
    
}
